﻿using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;

namespace Acme.BookStore2.Controllers
{
    [RemoteService(Name = "Default")]
    [Area("bookstore2")]
    [ControllerName("VehicleMaintenanceRecord")]
    [Route("api/bookstore2/VehicleMaintenanceRecords")]
    public class VehicleMaintenanceRecordController : BookStore2Controller, IVehicleMaintenanceRecordAppService
    {
        private readonly IVehicleMaintenanceRecordAppService _vehicleMaintenanceRecordAppService;

        public VehicleMaintenanceRecordController(IVehicleMaintenanceRecordAppService vehicleMaintenanceRecordAppService)
        {
            this._vehicleMaintenanceRecordAppService = vehicleMaintenanceRecordAppService;
        }
        
        [HttpGet]
        [Route("{id}")]
        public Task<VehicleMaintenanceRecordDto> GetAsync(Guid id)
        {
            return _vehicleMaintenanceRecordAppService.GetAsync(id);
        }
        
        [HttpGet]
        public Task<PagedResultDto<VehicleMaintenanceRecordDto>> GetPagedListAsync(GetVehicleMaintenanceRecordsInput input)
        {
            return _vehicleMaintenanceRecordAppService.GetPagedListAsync(input);
        }
        
        [HttpPost]
        public Task<VehicleMaintenanceRecordDto> CreateAsync(VehicleMaintenanceRecordCreateDto input)
        {
            return _vehicleMaintenanceRecordAppService.CreateAsync(input);
        }

        [HttpPut]
        [Route("{id}")]
        public Task<VehicleMaintenanceRecordDto> UpdateAsync(Guid id, VehicleMaintenanceRecordUpdateDto input)
        {
            return _vehicleMaintenanceRecordAppService.UpdateAsync(id, input);
        }

        [HttpDelete]
        [Route("{id}")]
        public Task DeleteAsync(Guid id)
        {
            return _vehicleMaintenanceRecordAppService.DeleteAsync(id);
        }

        [HttpGet] 
        [Route("export")]
        public Task ExportAsync(GetVehicleMaintenanceRecordsInput input)
        {
            return _vehicleMaintenanceRecordAppService.ExportAsync(input);
        }
    }
}